<ul id="primary">

    <?if ($this->mdl_nav->main_dashboard_active()) {?>
    <li><?=anchor('admin_index', 'Dashboard', array('class'=>'active'));?></li>
    <?} else {?>
    <li><?=anchor('admin_index', 'Dashboard');?></li>
    <?}?>

    <?if ($this->mdl_nav->main_write_active()) {?>
    <li><?=anchor('admin_posts/form', 'Write', array('class'=>'active'));?>
        <?} else {?>
    <li><?=anchor('admin_posts/form', 'Write');?>
        <?}?>
        <?if ($this->mdl_nav->main_write_active()) {?>
        <ul id="secondary">
                <?if ($this->mdl_nav->write_post_active()) {?>
            <li><?=anchor('admin_posts/form', 'Write Post', array('class'=>'subactive'));?></li>
                <?} else {?>
            <li><?=anchor('admin_posts/form', 'Write Post');?></li>
                <?}?>
                <?if ($this->mdl_nav->write_page_active()) {?>
            <li><?=anchor('admin_pages/form', 'Write Page', array('class'=>'subactive'));?></li>
                <?} else {?>
            <li><?=anchor('admin_pages/form', 'Write Page');?></li>
                <?}?>
        </ul>
        <?}?>
    </li>

    <?if ($this->mdl_nav->main_manage_active()) {?>
    <li><?=anchor('admin_posts/index', 'Manage', array('class'=>'active'));?>
        <?} else {?>
    <li><?=anchor('admin_posts/index', 'Manage');?>
        <?}?>

        <?if ($this->mdl_nav->main_manage_active()) {?>
        <ul id="secondary">

                <?if ($this->mdl_nav->post_index_active()) {?>
            <li><?=anchor('admin_posts/index', 'Posts', array('class'=>'subactive'));?></li>
                <?} else {?>
            <li><?=anchor('admin_posts/index', 'Posts');?></li>
                <?}?>

                <?if ($this->mdl_nav->page_index_active()) {?>
            <li><?=anchor('admin_pages/index', 'Pages', array('class'=>'subactive'));?></li>
                <?} else {?>
            <li><?=anchor('admin_pages/index', 'Pages');?></li>
                <?}?>

                <?if ($this->session->userdata('user_type_id') == 1 OR $this->session->userdata('user_type_id') == 2) {?>

                    <?if ($this->mdl_nav->category_active()) {?>
            <li><?=anchor('admin_categories/index', 'Categories', array('class'=>'subactive'));?></li>
                    <?} else {?>
            <li><?=anchor('admin_categories/index', 'Categories');?></li>
                    <?}?>

                    <?if ($this->mdl_nav->comment_index_active()) {?>
            <li><?=anchor('admin_comments/index', 'Comments', array('class'=>'subactive'));?></li>
                    <?} else {?>
            <li><?=anchor('admin_comments/index', 'Comments');?></li>
                    <?}?>

                    <?if ($this->mdl_nav->blogroll_active()) {?>
            <li><?=anchor('admin_blogroll/index', 'Blogroll', array('class'=>'subactive'));?></li>
                    <?} else {?>
            <li><?=anchor('admin_blogroll/index', 'Blogroll');?></li>
                    <?}?>

                <?}?>

        </ul>
        <?}?>

    </li>

    <?if (in_array($this->session->userdata('user_type_id'), array('1', '2'))) {?>

        <?if ($this->mdl_nav->main_system_active()) {?>
    <li><?=anchor('admin_sites/index', 'System', array('class'=>'active'));?>
            <?}else {?>
    <li><?=anchor('admin_sites/index', 'System');?>
            <?}?>
            <?if ($this->mdl_nav->main_system_active()) {?>
        <ul id="secondary">

                    <?if ($this->mdl_nav->site_active()) {?>
            <li><?=anchor('admin_sites/index', 'Sites', array('class'=>'subactive'));?></li>
                    <?} else {?>
            <li><?=anchor('admin_sites/index', 'Sites');?></li>
                    <?}?>

                    <?if ($this->mdl_nav->user_active()) {?>
            <li><?=anchor('admin_users/index', 'Users', array('class'=>'subactive'));?></li>
                    <?} else {?>
            <li><?=anchor('admin_users/index', 'Users');?></li>
                    <?}?>

                    <?if ($this->mdl_nav->spam_active()) {?>
            <li><?=anchor('admin_spam/index', 'Spam', array('class'=>'subactive'));?></li>
                    <?} else {?>
            <li><?=anchor('admin_spam/index', 'Spam');?></li>
                    <?}?>

                    <?if ($this->mdl_nav->visitor_active()) {?>
            <li><?=anchor('admin_visitors/index', 'Visitors', array('class'=>'subactive'));?></li>
                    <?} else {?>
            <li><?=anchor('admin_visitors/index', 'Visitors');?></li>
                    <?}?>

        </ul>
            <?}?>
    </li>
    <?}?>
</ul>